from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, BigInteger
from sqlalchemy.sql import func
from .base import Base,Business
from app.core.snowflake import snowflake

class User(Business):
    __tablename__ = "users"
    
    password = Column(String(255), nullable=False)
    email = Column(String(100), unique=True, nullable=False)

class Conversation(Base):
    __tablename__ = "conversations"

    id = Column(BigInteger, primary_key=True, default=snowflake.generate)
    user_id = Column(BigInteger, ForeignKey("users.id"), nullable=False)
    title = Column(String(100), nullable=False)
    description = Column(Text)

class Message(Base):
    __tablename__ = "messages"

    id = Column(BigInteger, primary_key=True, default=snowflake.generate)
    conversation_id = Column(BigInteger, ForeignKey("conversations.id"), nullable=False)
    role = Column(String(20), nullable=False)
    content = Column(Text, nullable=False)
    reason_content = Column(Text, nullable=False)